import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';

///
/// @DIR_PATH：lib/page/mine
/// @TIME：2024/6/23 13:39
/// @AUTHOR：starr
/// 关于我的页面
///
class AboutUsPage extends StatefulWidget {
  const AboutUsPage({super.key});

  @override
  State<StatefulWidget> createState() => AboutUsPageState();
}

class AboutUsPageState extends State<AboutUsPage> {
  String _versionName = "v";

  Future getVersion() async {
    PackageInfo info = await PackageInfo.fromPlatform();
    var version = info.version;
    _versionName = "v$version";
    print(_versionName);
    setState(() {});
  }

  @override
  void initState() {
    super.initState();
    //等待页面初始化完成再去设置信息
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      getVersion();
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("关于我们"),
      ),
      body: SafeArea(
        child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
          Image.asset("assets/images/a/ic_app.png",
              width: 50, height: 50),
          Text(_versionName),
          const SizedBox(width: double.infinity,)
        ]),
      )
    );
  }
}
